package com.ruoyi.listener;

import com.ruoyi.remark.domain.BoleRemarkProject;
import com.ruoyi.remark.service.IBoleRemarkProjectService;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class LeaveRequestService implements JavaDelegate {
    @Autowired
    private IBoleRemarkProjectService iBoleRemarkProjectService;
    @Override
    public void execute(DelegateExecution execution) throws Exception {
        // 1. 获取流程变量（如用户ID、请假天数）
        Long remarkId = (Long) execution.getVariable("remarkId");
//        int days = (Integer) execution.getVariable("leaveDays");
        BoleRemarkProject boleRemarkProject=new BoleRemarkProject();
        boleRemarkProject.setSubmitId(remarkId);
        boleRemarkProject.setStatus("3");//3是通过
        iBoleRemarkProjectService.updateBoleRemarkProject(boleRemarkProject);
        // 2. 构造HTTP请求（示例：POST到请假系统API）
        System.out.println("执行到这了"+boleRemarkProject.toString());
    }
}